package foo;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

class Test1 {
	public static void main(String[] argc){
		System.out.println("hello");

		// read properties
		Test1 test1 = new Test1();
		Properties prop = test1.loadProperties("abc.properties");
		System.out.println(prop.getProperty("name"));
	}

	public Properties loadProperties(String propFileName){
		InputStream ins = null;
		Properties prop = null;
		try {
			prop = new Properties();
			ins = getClass().getClassLoader().getResourceAsStream(propFileName);
 
			if (ins != null) {
				prop.load(ins);
				ins.close();
			} else {
				throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
			}
 
		} catch (Exception e) {
			System.out.println("Exception: " + e);
		}
		return prop;
	}
}